import request from "@/utils/request";
class AuthAPI {
  /*     ws登录验证     */
  static echoAuth (data) {
    return request({
      url: "/api/broadcasting/auth",
      method: "POST",
      data
    });
  }
  /*     登录     */
  static login (data) {
    return request({
      url: "/api/admin/login",
      method: "POST",
      data
    });
  }
  /*      CORS     */
  static csrfCookie () {
    return request({
      url: "/api/csrf-cookie",
      method: "get",
    });
  }
  /*    退出 登录     */
  static logout (data) {
    return request({
      url: "/api/admin/logout",
      method: "POST",
      data
    });
  }
  /*     token登录     */
  static loginToken (data) {
    return request({
      url: "/api/admin/auth/token",
      method: "POST",
      data
    });
  }
  /*    token 退出 登录     */
  static logoutToken (data) {
    return request({
      url: "/api/admin/auth/token",
      method: "DELETE",
      data
    });
  }
  /* 
  * 二次验证
  * data:{} 谷歌验证码：code  恢复代码：recovery_code    
  */
  static twoFactorChallenge (data) {
    return request({
      url: "/api/admin/two-factor-challenge",
      method: "POST",
      data
    });
  }
  /*    二次验证状态     */
  static pwdStatus () {
    return request({
      url: "/api/admin/user/confirmed-password-status",
      method: "get",
    });
  }
  /*    
  * 验证登录密码 
  * @data:{password: "password"}
  */
  static confirmPassword (data) {
    return request({
      url: "/api/admin/user/confirm-password",
      method: "POST",
      data
    });
  }
  /*    开启二次验证     */
  static switchTwo (data) {
    return request({
      url: "/api/admin/user/two-factor-authentication",
      method: "POST",
      data
    });
  }
  /*    关闭二次验证     */
  static delTwo () {
    return request({
      url: "/api/admin/two-factor-authentication",
      method: "DELETE",
    });
  }
  /*    二次验证二维码     */
  static twoQrCode () {
    return request({
      url: "/api/admin/two-factor-qr-code",
      method: "get",
    });
  }
  /*    二次验证设置密钥     */
  static twoKey () {
    return request({
      url: "/api/admin/two-factor-secret-key",
      method: "get",
    });
  }
  /*    确认二次验证    */
  static verifyTwo (data) {
    return request({
      url: "/api/admin/confirmed-two-factor-authentication",
      method: "POST",
      data
    });
  }
}
export default AuthAPI;
